package com.qdlc.p2p.biz.log.score.identify;

import com.qdlc.p2p.biz.log.score.BaseTenderScoreLog;
import com.qdlc.p2p.common.constant.Global;
import com.qdlc.p2p.common.constant.ScoreTemplateConstant;
import com.qdlc.p2p.common.exception.ScoreException;

/**
 * 实名认证获得积分
 */
public class RealnameScoreLog extends BaseTenderScoreLog {
	
	private static final long serialVersionUID = 1L;

	private String logTemplateNid = ScoreTemplateConstant.SCORE_REAL_NAME;
	
	public RealnameScoreLog() {
		super();
	}

	public RealnameScoreLog(long userId) {
		super(userId, 0, ScoreTemplateConstant.SCORE_REAL_NAME);
		int score = this.getScoreValue(logTemplateNid);
		this.setScore(score);
		Global.setTransfer("score", score);
		this.setLogTemplateNid(logTemplateNid);
	}
	
	@Override
	public void modifyScore() {
		Boolean result = scoreDao.updateScore(this.getUser().getUserId(), this.getScore(), this.getScore(), 0, 0);
		if(!result){
			throw new ScoreException("更新用户积分失败！", 1);
		}
	}
}
